/*
 * Copyright (c)  2016, dabing.io
 * All rights reserved.
 * Activity.java 2017-09-16 上午10:51
 */

package com.ueboot.weishop.entity.activity;

import com.ueboot.weishop.entity.IDEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;

/**
 * 描述:满减,满赠，加价购活动额外的属性
 *
 * @author yangkui create on 2017-09-16.
 * @since 1.0
 */
@Data
@NoArgsConstructor
@Entity(name = "WS_MONEY_OFF_ACTIVITY")
public class MoneyOffActivityEntity extends IDEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "WS_MONEY_OFF_ACTIVITY")
    @GenericGenerator(name = "WS_MONEY_OFF_ACTIVITY", strategy = "enhanced-table", parameters = {
            @org.hibernate.annotations.Parameter(name = "table_name", value = "WS_TABLE_SEQUENCE"),
            @org.hibernate.annotations.Parameter(name = "segment_value", value = "WS_MONEY_OFF_ACTIVITY"),
            @org.hibernate.annotations.Parameter(name = "optimizer", value = "pooled")})
    @Column(name = "ID", columnDefinition = "INT(20) COMMENT 'id主键'", length = 20)
    private Long id;

    /**
     * 活动基本信息
     */
    @ManyToOne
    @JoinColumn(name="ACTIVITY_ID",columnDefinition = "INT(20) COMMENT '活动基本信息'")
    private ActivityEntity activity;
    //满足的条件

    /**
     * 订单满XX元，单位分
     */
    @Column(name = "MAX_PRICE",columnDefinition = "INT(11) COMMENT '订单满XX元，单位分'",length = 11)
    private int maxPrice;

    /**
     * 订单满X件
     */
    @Column(name = "MAX_COUNT",columnDefinition = "INT(11) COMMENT '订单满X件'",length = 11)
    private int maxCount;

    //优惠的活动，三选一
    //1.减去金额、2.打折、3.赠送商品、4.加价购换购商品
    /**
     * 减去X元，单位分。
     */
    @Column(name = "MINUS_PRICE",columnDefinition = "INT(11) COMMENT '减去X元，单位分。'",length = 11)
    private int minusPrice;

    /**
     * 优惠折扣
     */
    @Column(name = "DISCOUNT_VALUE",columnDefinition = "INT(11) COMMENT '优惠折扣'",length = 11)
    private int discountValue;


    /**
     * 赠送的商品ID集合，ID使用,分割
     */
    @Column(name = "GIFT_GOODS_IDS",columnDefinition = "VARCHAR(200) COMMENT '赠送的商品ID集合，ID使用,分割'",length = 200)
    private String giftGoodsIds;


}